home *** CD-ROM | disk | FTP | other *** search
- unit UAbout;
-
- interface
-
- uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
- Buttons, ExtCtrls;
-
- type
- TAboutBox = class(TForm)
- Panel1: TPanel;
- ProgramIcon: TImage;
- ProductName: TLabel;
- Version: TLabel;
- Copyright: TLabel;
- OKButton: TButton;
- private
- { Private declarations }
- protected
- function GetAppVersion: string;
- public
- { Public declarations }
- constructor Create(Owner: TComponent); override;
- end;
-
- var
- AboutBox: TAboutBox;
-
- implementation
-
- {$R *.DFM}
-
- function TAboutBox.GetAppVersion: string;
- var
- ptrBlock, verInfo: Pointer;
- verInfoSize, tmp: integer;
- FileName: array[0..260] of Char;
- begin
- Result := '';
- GetModuleFileName(0, FileName, SizeOf(FileName)); // Get host application name
- // version resource querying
- verInfoSize := GetFileVersionInfoSize(FileName, tmp);
- if verInfoSize > 0 then begin
- ptrBlock := AllocMem(verInfoSize);
- try
- GetFileVersionInfo(FileName, 0, verInfoSize, ptrBlock);
- VerQueryValue(ptrBlock, '\', verInfo, tmp);
- with PVSFixedFileInfo(verInfo)^ do
- Result := ' Version ' +
- IntToStr(dwProductVersionMS div 65536) + '.' +
- IntToStr(dwProductVersionMS mod 65536) + '.' +
- IntToStr(dwProductVersionLS div 65536) + '.' +
- IntToStr(dwProductVersionLS mod 65536);
- finally
- FreeMem(ptrBlock);
- end;
- end;
- end;
-
- constructor TAboutBox.Create(Owner: TComponent);
- begin
- inherited Create(Owner);
- ProductName.Caption := Application.Title;
- try
- Version.Caption := GetAppVersion;
- except
- Version.Caption := '(No version info)'
- end;
- end;
-
- end.
-
-